Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next |

Converting Process Serial Numbers and Port Names

The Event Manager provides two functions to convert between process serial numbers and port names: GetProcessSerialNumberFromPortName (GetProcessSerialNumberFromPortName) and GetPortNameFromProcessSerialNumber (GetPortNameFromProcessSerialNumber) . Both functions are intended to map serial numbers to port names (or vice versa) for applications open on the local computer. They do not return useful results for applications open on remote computers.

GetProcessSerialNumberFromPortName

Use GetProcessSerialNumberFromPortName to get the process serial number of a process.

pascal OSErr GetProcessSerialNumberFromPortName
                                         (const PPCPortRec *portName,
                                          ProcessSerialNumber *pPSN);
portName
A pointer to a PPC port record, the contents of which specify the port name registered to a process whose serial number you want.
pPSN
Returns a pointer to the process serial number of the process designated through the portName parameter. You can use the returned process serial number to send a high-level event to that process. Do not interpret the value of the process serial number.

DESCRIPTION

The GetProcessSerialNumberFromPortName function returns, in the pPSN parameter, a pointer to the process serial number of the process registered at a specific port.

SPECIAL CONSIDERATIONS

The GetProcessSerialNumberFromPortName function does not move or purge memory but for other reasons should not be called from within an interrupt, such as in a completion routine or VBL task.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the GetProcessSerialNumberFromPortName function are

Trap macro

Selector

_OSDispatch

$0035

RESULT CODES

noErr

0

No error

noPortErr

-903

Invalid port name

SEE ALSO

For a description of the PPCPortRec data type, see the chapter "Program-to-Program Communications Toolbox" in Inside Macintosh: Interapplication Communication .

GetPortNameFromProcessSerialNumber

Use GetPortNameFromProcessSerialNumber to get the port name of a process.

pascal OSErr GetPortNameFromProcessSerialNumber
                                         (PPCPortRec *portName,
                                          const ProcessSerialNumber *pPSN);
portName
Returns a pointer to a PPC port record, the contents of which specify the port name of the process designated by the pPSN parameter. You can use the returned port name to send a high-level event to that process.
PSN
A pointer to the process serial number of the process whose port name you want.

DESCRIPTION

The GetPortNameFromProcessSerialNumber function returns, through the portName parameter, the port name registered to a process having a specific process serial number.

SPECIAL CONSIDERATIONS

The GetPortNameFromProcessSerialNumber function does not move or purge memory but for other reasons should not be called from within an interrupt, such as in a completion routine or VBL task.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the GetPortNameFromProcessSerialNumber function are

Trap macro

Selector

_OSDispatch

$0046

RESULT CODES

noErr

0

No error

procNotFound

-600

No eligible process with specified process serial number

SEE ALSO

For a description of the PPCPortRec data type, see the chapter "Program-to-Program Communications Toolbox" in Inside Macintosh: Interapplication Communication.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next